// A fully functional OPC UA demo server running in Windows service host. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client, server and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-OPCStudio-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System.ServiceProcess; namespace UAServerWindowsServiceDemo { static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main() { var servicesToRun = new ServiceBase[] { new UAService1() }; ServiceBase.Run(servicesToRun); } } }
// A fully functional OPC UA demo server running in Windows service host. // // See also: // https://docs.microsoft.com/en-us/dotnet/framework/windows-services/how-to-add-installers-to-your-service-application // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client, server and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-OPCStudio-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System.ComponentModel; namespace UAServerWindowsServiceDemo { [RunInstaller(true)] public partial class ProjectInstaller : System.Configuration.Install.Installer { public ProjectInstaller() { InitializeComponent(); } } }
// A fully functional OPC UA demo server running in Windows service host. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client, server and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-OPCStudio-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. namespace UAServerWindowsServiceDemo { partial class ProjectInstaller { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); // // serviceProcessInstaller1 // this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem; this.serviceProcessInstaller1.Password = null; this.serviceProcessInstaller1.Username = null; // // serviceInstaller1 // this.serviceInstaller1.Description = "This server demo is written in .NET, and it shows how to use the component to cre" + "ate an OPC UA server hosted in a Windows service. It provides readable and writa" + "ble nodes of various types."; this.serviceInstaller1.DisplayName = "OPC Wizard .NET Windows Service Demo"; this.serviceInstaller1.ServiceName = "OpcWizardDemo"; // // ProjectInstaller // this.Installers.AddRange(new System.Configuration.Install.Installer[] { this.serviceProcessInstaller1, this.serviceInstaller1}); }
// UAServerWindowsServiceDemo: Shows how to use the component to create an OPC UA server hosted in a Windows service. It // provides readable and writable nodes of various types. // // Install the service by running: // C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /i UAServerWindowsServiceDemo.exe // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client, server and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-OPCStudio-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System.ServiceProcess; using OpcLabs.EasyOpc.UA; using UAServerDemoLibrary; namespace UAServerWindowsServiceDemo { public partial class UAService1 : ServiceBase { public UAService1() { InitializeComponent(); // Define various nodes. ConsoleNodes.AddToParent(_server.Objects); DataNodes.AddToParent(_server.Objects); DemoNodes.AddToParent(_server.Objects); } protected override void OnStart(string[] args) { // Start the server. _server.Start(); } protected override void OnStop() { // Stop the server. _server.Stop(); } // The server object. // By default, the server will run on endpoint URL "opc.tcp://localhost:48040/". private readonly EasyUAServer _server = new EasyUAServer(); } }
// UAServerWindowsServiceDemo: Shows how to use the component to create an OPC UA server hosted in a Windows service. It // provides readable and writable nodes of various types. // // Install the service by running: // C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /i UAServerWindowsServiceDemo.exe // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client, server and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-OPCStudio-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. namespace UAServerWindowsServiceDemo { partial class UAService1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Component Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.easyUAServer1 = new OpcLabs.EasyOpc.UA.EasyUAServer(this.components); // // easyUAServer1 // // UAService1 // this.ServiceName = "OpcWizardDemo"; }
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Documentation Home, Send Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.